Skip to content

Align with backchannel logout OIDC spec#1432

Draft
Spitfireap wants to merge 5 commits intonextcloud:mainfrom
Spitfireap:fix/1430-backchannel-oidc-spec
Draft

Align with backchannel logout OIDC spec#1432
Spitfireap wants to merge 5 commits intonextcloud:mainfrom
Spitfireap:fix/1430-backchannel-oidc-spec

Conversation

@Spitfireap
Copy link
Copy Markdown

@Spitfireap Spitfireap commented Apr 28, 2026

fixes #1430

Current behaviour

Backchannel logout yields a HTTP/400 error when the session is not retrieved.
The spec states that it should be considered as a success and thus should return HTTP/200 :

If the identified End-User is already logged out at the RP when the logout request is received, the logout is considered to have succeeded.

Furthermore the response seems to be missing the Cache-Control header (spec).

The BC logout validation is also missing exp token validation (not expired) and iss validation (equals to issuer in discovery endpoint) per Backchannel logout token validation spec and ID Token validation spec

Changes

  • Yield a success (HTTP/200) when the session is not found instead of an error (HTTP/400)
  • Removed an unused variable from getBackchannelLogoutErrorResponse ($throttleMetadata)
  • Increased the severity of the logging when a Backchannel logout fails
  • Added the Cache-Control header in the backchannel logout response
  • Added a verification for the exp and iss claim

@Spitfireap Spitfireap force-pushed the fix/1430-backchannel-oidc-spec branch from da506df to 149ded7 Compare April 28, 2026 18:33
@Spitfireap
Copy link
Copy Markdown
Author

@julien-nc not entirely sure about the change for the error logging.
I think the severity should be increased since it might be a security issue. The thing is : could these be triggered by a random idp and in that case we should perhaps be cautious about using error or it requires the idp to be verified so error would be well suited ?

Copy link
Copy Markdown
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, thanks. Let's get #1431 in first, then you can rebase and adjust this one.

Comment thread lib/Controller/LoginController.php Outdated
Comment thread lib/Controller/LoginController.php
@Spitfireap Spitfireap force-pushed the fix/1430-backchannel-oidc-spec branch 2 times, most recently from 0478e3e to 05b982d Compare April 29, 2026 12:07
@Spitfireap
Copy link
Copy Markdown
Author

Spitfireap commented Apr 29, 2026

Added some more alignment with the spec (exp + 1 iss validation step).

Was wondering if we should verify that jti and iat claims are there as well (since they are required) or am I overdoing it ?

Copy link
Copy Markdown
Member

@julien-nc julien-nc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey. #1431 is merged. Sorry there seems to be a small conflict with your branch. You can rebase on main or just merge main in your branch to resolve the conflict.

Was wondering if we should verify that jti and iat claims are there as well...

Yeah sure, let's keep it simple: It's enough to check if those token attributes are defined.

Comment thread lib/Controller/LoginController.php Outdated
['iss_should_be_set' => true]
true
);
} elseif ($iss !== $discovery['issuer']) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$iss is not defined at this point.

Comment thread lib/Controller/LoginController.php Outdated
Comment on lines +1026 to +1027
$this->logger->error('Backchannel logout error. ' . $error . ' ; ' . $description .
'. This is likely an IdP issue.');
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->logger->error('Backchannel logout error. ' . $error . ' ; ' . $description .
'. This is likely an IdP issue.');
$this->logger->error('Backchannel logout error. ' . $error . ' ; ' . $description .
'. This is likely an IdP issue.', ['metadata' => $metadata]);

You could keep the metadata param (which can be renamed) and include it in the logs so the information is more precise than the $isLikelyIdpSide boolean. Wdyt?

Comment thread lib/Controller/LoginController.php Outdated
['multiple_sessions_found' => $sid]
);
$this->logger->warning('[BackchannelLogout] Multiple OIDC sessions retrieved (sid+sub+iss). ' .
'This should not happen. Please check that you have created your DB indexes')
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing ;

@Spitfireap
Copy link
Copy Markdown
Author

Hey. #1431 is merged. Sorry there seems to be a small conflict with your branch. You can rebase on main or just merge main in your branch to resolve the conflict.

Was wondering if we should verify that jti and iat claims are there as well...

Yeah sure, let's keep it simple: It's enough to check if those token attributes are defined.

Working on May the 1st are you :p ?
I'll push the rebase and some rework, then test it a bit on my instance. I'll ping you when it's ready.

@julien-nc
Copy link
Copy Markdown
Member

Working on May the 1st are you :p ?

Checking your github notifications on May 1st? 😁

Yeah for a weird reason I'm working today. I can tell you on a private channel if you're curious.

I'll push the rebase and some rework, then test it a bit on my instance. I'll ping you when it's ready.

Nice! Thank you for the enthusiasm. No rush though, feel free to take the public holiday 😉

Spitfireap added 5 commits May 2, 2026 00:39
refurbished $throttleMetadata not used since 9b5d6c6

Signed-off-by: Spitap <dev@asdrip.fr>
Signed-off-by: Spitap <dev@asdrip.fr>
Signed-off-by: Spitap <dev@asdrip.fr>
Signed-off-by: Spitap <dev@asdrip.fr>
Signed-off-by: Spitap <dev@asdrip.fr>
@Spitfireap Spitfireap force-pushed the fix/1430-backchannel-oidc-spec branch from f0865f4 to f209fb6 Compare May 1, 2026 22:54
@Spitfireap Spitfireap marked this pull request as draft May 1, 2026 23:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RP initiated logout makes backchannel logout throw an HTTP/400 error

2 participants